package com.blog;

import com.blog.common.utils.StringUtils;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * 启动程序
 * 
 * @author Auman
 */
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class BlogProApplication
{
    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext application = SpringApplication.run(BlogProApplication.class, args);
        Environment env = application.getEnvironment();
        String ip = InetAddress.getLocalHost().getHostAddress();
        String port = env.getProperty("server.port");
        String path = StringUtils.trim(env.getProperty("server.servlet.context-path"));

        System.out.println("知码意后台系统启动成功!!!\n" +
                "Local: \t\thttp://localhost:" + port + path + "\n" +
                "External: \t\thttp://" + ip + ":" + port + path + "\n" +
                "Swagger-ui: \t\thttp://" + ip + ":" + port + path + "swagger-ui/index.html\n"+
                "Swagger-bootstrap-ui: \t\thttp://" + ip + ":" + port + path + "doc.html\n");
    }
}
